import os

def scan_directory(directory):
    """递归扫描目录下的所有.xls和.xlsx文件"""
    excel_files = []
    for root, dirs, files in os.walk(directory):
        for file in files:
            if file.endswith('.xls') or file.endswith('.xlsx'):
                excel_files.append(os.path.join(root, file))
    return excel_files